.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.stack 200
.data
__error_resta db "RESULTADO NEGATIVO EN RESTA", 0
__error_overflow db "OVERFLOW EN PRODUCTO", 0
__error_division db "ERROR EN DIVISION", 0
__error db "ERROR", 0
_ASIG1MAL db "ASIG 1 MAL", 0
_ASIG3BIEN db "ASIG 3 BIEN", 0
_0ui dw 0
_ASIG4BIEN db "ASIG 4 BIEN", 0
_2ui dw 2
_ASIG3MAL db "ASIG 3 MAL", 0
_4ul dd 4
_ASIG2MAL db "ASIG 2 MAL", 0
_180ui dw 180
_24ul dd 24
_104ui dw 104
_16ui dw 16
_ASIG1BIEN db "ASIG 1 BIEN", 0
_e dd ?
_32ui dw 32
_d dd ?
_c dd ?
_ASIG4MAL db "ASIG 4 MAL", 0
_b dw ?
_a dw ?
_ASIG2BIEN db "ASIG 2 BIEN", 0
.code
start:
MOV bx, _32ui
MOV _a, bx
MOV bx, _16ui
MOV _b, bx
MOV ebx, _4ul
MOV _c, ebx
MOV ebx, 0
MOV bx, _2ui
MOV _d, ebx
MOV ebx, 0
MOV bx, _0ui
MOV _e, ebx
MOV ax, _b
MUL _a
JO overflow
MOV bx, ax
MOV edx, 0
MOV eax, 0
MOV ax, bx
DIV _c
MOV bx, ax
MOV ecx, 0
MOV cx, bx
ADD ecx, _c
ADD ecx, _c
MOV eax, 0
MOV ax, _a
SUB ecx, eax
JS res_negativo
MOV eax, 0
MOV ax, _104ui
CMP ecx, eax
JNE @Label34
invoke MessageBox, NULL, addr _ASIG1BIEN, addr _ASIG1BIEN, MB_OK
JMP @Label36
@Label34:
invoke MessageBox, NULL, addr _ASIG1MAL, addr _ASIG1MAL, MB_OK
@Label36:
MOV ecx, 0
MOV cx, _b
MOV eax, ecx
MUL _c
JO overflow
MOV ecx, eax
MOV eax, ecx
DIV _b
MOV ecx, eax
MOV eax, ecx
MUL _d
JO overflow
MOV edx, eax
MOV edx, 0
MOV dx, _a
SUB edx, eax
JS res_negativo
JB @Label53
invoke MessageBox, NULL, addr _ASIG2BIEN, addr _ASIG2BIEN, MB_OK
JMP @Label55
@Label53:
invoke MessageBox, NULL, addr _ASIG2MAL, addr _ASIG2MAL, MB_OK
@Label55:
MOV ax, _a
MUL _b
JO overflow
MOV bx, ax
MOV ecx, 0
MOV cx, bx
MOV eax, ecx
MUL _c
JO overflow
MOV ecx, eax
MOV eax, ecx
DIV _b
MOV ecx, eax
MOV eax, 0
MOV ax, _a
ADD ecx, eax
MOV ecx, 0
MOV cx, _180ui
CMP ecx, ecx
JBE @Label72
invoke MessageBox, NULL, addr _ASIG3BIEN, addr _ASIG3BIEN, MB_OK
JMP @Label74
@Label72:
invoke MessageBox, NULL, addr _ASIG3MAL, addr _ASIG3MAL, MB_OK
@Label74:
MOV ebx, 0
MOV bx, _a
MOV eax, ebx
MUL _d
JO overflow
MOV ebx, eax
MOV ecx, 0
MOV cx, _b
MOV eax, ecx
MUL _c
JO overflow
MOV ecx, eax
SUB ebx, eax
JS res_negativo
MOV eax, _d
DIV _a
MOV edx, eax
JNE @Label91
invoke MessageBox, NULL, addr _ASIG4BIEN, addr _ASIG4BIEN, MB_OK
JMP @Label93
@Label91:
invoke MessageBox, NULL, addr _ASIG4MAL, addr _ASIG4MAL, MB_OK
@Label93:
jmp fin
overflow:
invoke MessageBox, NULL, addr __error_overflow, addr __error, MB_OK
invoke ExitProcess, 0
res_negativo:
invoke MessageBox, NULL, addr __error_resta, addr __error, MB_OK
invoke ExitProcess, 0
division:
invoke MessageBox, NULL, addr __error_division, addr __error, MB_OK
invoke ExitProcess, 0
fin:
invoke ExitProcess, 0
end start